﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;


using SlimDX;
using SlimDX.Direct3D11;
using System.Runtime.Serialization;

namespace Vxl.Drawables
{
    [DataContract]
    public class Drawable
    {
        public void SetMaterialInfo(float sigma, float rho)
        {
            A = 1.0f - 0.5f * (sigma * sigma)/(sigma*sigma + 0.33f);
			B = 0.45f * (sigma * sigma)/(sigma * sigma + 0.09f);
			rhoOverPi = rho/(float)Math.PI;
        }

        [DataMember(Name = "A")]
	    protected float A;
        [DataMember(Name = "B")]
        protected float B;

        protected float rhoOverPi;

        protected SlimDX.Direct3D11.Buffer vertexBuffer;

        protected VertexBufferBinding vertexBufferBinding;

        protected Matrix world;

        protected bool worldMatrixHasChanged;

        private Vector3 pos;
        public Vector3 Position
        {
            get
            {
                return pos;
            }
            set
            {
                pos = value;
                Translation = Matrix.Translation(pos);
                worldMatrixHasChanged = true;
            }
        }

        protected Matrix Translation;

        private Matrix rot;

        public Matrix Rotation{
            get
            {
                return rot;
            }
            set
            {
                rot = value;
                worldMatrixHasChanged = true;
            }
        }
    }
}
